<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增会员')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-member-add">
			<div class="form-group">	
				<label class="col-sm-3 control-label">会员名：</label>
				<div class="col-sm-8">
					<input id="name" name="name" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">头像：</label>
				<div class="col-sm-8">
					<input id="avatar" name="avatar" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">生日：</label>
				<div class="col-sm-8">
					<input type="text" class="time-input form-control" id="birthDay" placeholder="生日" name="birthDay" />
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">性别：</label>
				<div class="col-sm-8">
					<select id="sex" name="sex" class="form-control" >
						<option value="0">保密</option>
						<option value="1">男</option>
						<option value="2">女</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">已婚状态：</label>
				<div class="col-sm-8">
					<select id="wedlock" name="wedlock" class="form-control" >
						<option value="0">保密</option>
						<option value="1">未婚</option>
						<option value="2">已婚</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">会员等级：</label>
				<div class="col-sm-8">
					<select id="memberLvId" name="memberLvId" class="form-control">
						<option value="">请选择...</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">等级过期时间：</label>
				<div class="col-sm-8">
					<input type="text" class="time-input form-control" id="lvExpireTime" placeholder="等级过期时间" name="lvExpireTime" />
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">教育程度：</label>
				<div class="col-sm-8">
					<input id="education" name="education" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">职业：</label>
				<div class="col-sm-8">
					<input id="vocation" name="vocation" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">注册平台：</label>
				<div class="col-sm-8">
					<select id="source" name="source" class="form-control" >
						<option value="">请选择...</option>
						<option value="1">pc</option>
						<option value="2">wap</option>
						<option value="3">微信公众号</option>
						<option value="4">微信小程序</option>
						<option value="5">app</option>
					</select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<input id="remark" name="remark" class="form-control" type="text">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">状态：</label>
				<div class="col-sm-8">
					<select id="disabled" name="disabled" class="form-control">
						<option value="0">有效</option>
						<option value="1">无效</option>
					</select>
				</div>
			</div>
		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "member/member"

		$(function () {
			$('#memberLvId').empty('');
			$('#memberLvId').append('<option value="" selected="selected">请选择...</option>');
			$.ajax({
				url: ctx + "member/memberLv/list",
				type: 'POST',
				data: {
					disabled: 0
				},
				success: function (result) {
					if (result.code == web_status.SUCCESS) {
						if (result.total > 0) {
							var rows = result.rows;
							rows.forEach(function (item, index) {
								$('#memberLvId').append('<option value="' + item.memberLvId + '">' + item.name + '</option>');
							});
						}
					} else {

					}
				}
			});
		});

		$("#form-member-add").validate({
			rules:{
				name:{
					required:true,
					maxlength:100
				},
				birthDay:{
					required:true
				},
				sex:{
					required:true
				},
				wedlock:{
					required:true
				},
				memberLvId:{
					required:true
				},
				lvExpireTime:{
					required:true
				},
				source:{
					required:true
				},
				disabled:{
					required:true
				}
			},
			focusCleanup: true
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-member-add').serialize());
	        }
	    }
	</script>
</body>
</html>
